﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebUI.constant;

namespace WebUI.Units
{
    /// <summary>
    /// 状态码字典
    /// </summary>
    public class CodeDictionary
    {
        private static Dictionary<CodeEnum, String> codeDir = new Dictionary<CodeEnum, string>
            {
                { CodeEnum.EMAIL_EMPTY, "邮箱为空" }
                 ,{ CodeEnum.LOGIN_SUCCESS,"登陆成功"}
                 ,{CodeEnum.LOGIN_FAILED,"登陆失败"  }
                ,{CodeEnum.EMAIL_OR_PASSWORD_EMPTY,"密码或者邮箱不能为空" }
                ,{ CodeEnum.NOT_LOGIN,"没有登陆"}
                ,{ CodeEnum.EDITE_SUCCESS,"修改成功"}
                ,{ CodeEnum.EDITE_FAILED,"修改失败"}
                ,{CodeEnum.EMAIL_FORMAT_ERROR,"邮箱格式错误"}
                 ,{CodeEnum.PASSWORD_TOO_EASY,"密码过于简单，必须由大小写字母数字特殊字符组合"}
                ,{ CodeEnum.REG_SUCCESS,"注册成功"}
                ,{ CodeEnum.REG_FAILED,"注册失败"}
                ,{ CodeEnum.LOGINOUT_SUCCESS,"注销成功"}
                ,{ CodeEnum.SELECT_SUCCESS,"查询成功"}
                ,{ CodeEnum.NOT_AUTHORITY_EDITE,"没有权限修改"}
                ,{ CodeEnum.EMPTY_DATA_ERROR,"无效数据"}
                ,{ CodeEnum.CREATE_QESTIONNAIRE_SUCCESS,"添加问卷成功"}
                ,{ CodeEnum.CREATE_QESTIONNAIRE_FAILED,"添加问卷失败"}
                ,{ CodeEnum.DELETE_SUCCESS,"删除成功"}
                ,{ CodeEnum.POST_QUESTIONFEEDBACK_FAILED ,"提交问卷失败"}
                ,{ CodeEnum.POST_QUESTIONFEEDBACK_SUCCESS,"提交问卷成功"}
                ,{ CodeEnum.ERROR_404,"找不到这个资源"}
                ,{ CodeEnum.ERROR_500,"服务器错误"}
            };

        /// <summary>
        /// 根据状态码获取对应的含义
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static String GetCodeMsg(CodeEnum code)
        {
            return codeDir[code];
        }
    }
}